-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsysfs.html
More file actions
387 lines (309 loc) · 17.6 KB
/
sysfs.html
File metadata and controls
387 lines (309 loc) · 17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<!DOCTYPE html>
<!-- saved from url=(0050)https://man7.org/linux/man-pages/man5/sysfs.5.html -->
<html lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>sysfs(5) - Linux manual page</title>
<link rel="stylesheet" type="text/css" href="./sysfs_files/style.css" title="style">
<link rel="stylesheet" type="text/css" href="./sysfs_files/style(1).css" title="style">
</head>
<body>
<div class="page-top"><a id="top_of_page"></a></div>
<!--%%%TOP_BAR%%%-->
<div class="nav-bar">
<table class="nav-table">
<tbody><tr>
<td class="nav-cell">
<p class="nav-text">
<a href="https://man7.org/index.html">man7.org</a> > Linux > <a href="https://man7.org/linux/man-pages/index.html">man-pages</a>
</p>
</td>
<td class="training-cell">
<p class="training-text"><a class="training-link" href="http://man7.org/training/">Linux/UNIX system programming training</a></p>
</td>
</tr>
</tbody></table>
</div>
<hr class="nav-end">
<!--%%%PAGE_START%%%-->
<h1>sysfs(5) — Linux manual page</h1>
<table class="sec-table">
<tbody><tr>
<td>
<p class="section-dir">
<a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#NAME">NAME</a> | <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#DESCRIPTION">DESCRIPTION</a> | <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#STANDARDS">STANDARDS</a> | <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#HISTORY">HISTORY</a> | <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#NOTES">NOTES</a> | <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#SEE_ALSO">SEE ALSO</a> | <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#COLOPHON">COLOPHON</a>
</p>
</td>
</tr>
<tr>
<td class="search-box">
<div class="man-search-box">
<form method="get" action="https://www.google.com/search">
<fieldset class="man-search">
<input type="text" name="q" size="10" maxlength="255" value="">
<input type="hidden" name="sitesearch" value="man7.org/linux/man-pages">
<input type="submit" name="sa" value="Search online pages">
</fieldset>
</form>
</div>
</td>
<td> </td>
</tr>
</tbody></table>
<!--%%%TEXT_START%%%-->
<pre><span class="headline"><i>sysfs</i>(5) File Formats Manual <i>sysfs</i>(5)</span>
</pre>
<h2><a id="NAME" href="https://man7.org/linux/man-pages/man5/sysfs.5.html#NAME"></a>NAME <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#top_of_page"><span class="top-link">top</span></a></h2><pre> sysfs - a filesystem for exporting kernel objects
</pre>
<h2><a id="DESCRIPTION" href="https://man7.org/linux/man-pages/man5/sysfs.5.html#DESCRIPTION"></a>DESCRIPTION <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#top_of_page"><span class="top-link">top</span></a></h2><pre> The <b>sysfs </b>filesystem is a pseudo-filesystem which provides an
interface to kernel data structures. (More precisely, the files
and directories in <b>sysfs </b>provide a view of the <i>kobject</i> structures
defined internally within the kernel.) The files under <b>sysfs</b>
provide information about devices, kernel modules, filesystems,
and other kernel components.
The <b>sysfs </b>filesystem is commonly mounted at <i>/sys</i>. Typically, it
is mounted automatically by the system, but it can also be mounted
manually using a command such as:
mount -t sysfs sysfs /sys
Many of the files in the <b>sysfs </b>filesystem are read-only, but some
files are writable, allowing kernel variables to be changed. To
avoid redundancy, symbolic links are heavily used to connect
entries across the filesystem tree.
<b>Files and directories</b>
The following list describes some of the files and directories
under the <i>/sys</i> hierarchy.
<i>/sys/block</i>
This subdirectory contains one symbolic link for each block
device that has been discovered on the system. The
symbolic links point to corresponding directories under
<i>/sys/devices</i>.
<i>/sys/bus</i>
This directory contains one subdirectory for each of the
bus types in the kernel. Inside each of these directories
are two subdirectories:
<i>devices</i>
This subdirectory contains symbolic links to entries
in <i>/sys/devices</i> that correspond to the devices
discovered on this bus.
<i>drivers</i>
This subdirectory contains one subdirectory for each
device driver that is loaded on this bus.
<i>/sys/class</i>
This subdirectory contains a single layer of further
subdirectories for each of the device classes that have
been registered on the system (e.g., terminals, network
devices, block devices, graphics devices, sound devices,
and so on). Inside each of these subdirectories are
symbolic links for each of the devices in this class.
These symbolic links refer to entries in the <i>/sys/devices</i>
directory.
<i>/sys/class/net</i>
Each of the entries in this directory is a symbolic link
representing one of the real or virtual networking devices
that are visible in the network namespace of the process
that is accessing the directory. Each of these symbolic
links refers to entries in the <i>/sys/devices</i> directory.
<i>/sys/dev</i>
This directory contains two subdirectories <i>block/</i> and
<i>char/</i>, corresponding, respectively, to the block and
character devices on the system. Inside each of these
subdirectories are symbolic links with names of the form
<i>major-ID</i>:<i>minor-ID</i>, where the ID values correspond to the
major and minor ID of a specific device. Each symbolic
link points to the <b>sysfs </b>directory for a device. The
symbolic links inside <i>/sys/dev</i> thus provide an easy way to
look up the <b>sysfs </b>interface using the device IDs returned
by a call to <a href="https://man7.org/linux/man-pages/man2/stat.2.html">stat(2)</a> (or similar).
The following shell session shows an example from <i>/sys/dev</i>:
$ <b>stat -c "%t %T" /dev/null</b>
1 3
$ <b>readlink /sys/dev/char/1\:3</b>
../../devices/virtual/mem/null
$ <b>ls -Fd /sys/devices/virtual/mem/null</b>
/sys/devices/virtual/mem/null/
$ <b>ls -d1 /sys/devices/virtual/mem/null/*</b>
/sys/devices/virtual/mem/null/dev
/sys/devices/virtual/mem/null/power/
/sys/devices/virtual/mem/null/subsystem@
/sys/devices/virtual/mem/null/uevent
<i>/sys/devices</i>
This is a directory that contains a filesystem
representation of the kernel device tree, which is a
hierarchy of <i>device</i> structures within the kernel.
<i>/sys/firmware</i>
This subdirectory contains interfaces for viewing and
manipulating firmware-specific objects and attributes.
<i>/sys/fs</i>
This directory contains subdirectories for some
filesystems. A filesystem will have a subdirectory here
only if it chose to explicitly create the subdirectory.
<i>/sys/fs/cgroup</i>
This directory conventionally is used as a mount point for
a <a href="https://man7.org/linux/man-pages/man5/tmpfs.5.html">tmpfs(5)</a> filesystem containing mount points for
<a href="https://man7.org/linux/man-pages/man7/cgroups.7.html">cgroups(7)</a> filesystems.
<i>/sys/fs/smackfs</i>
The directory contains configuration files for the SMACK
LSM. See the kernel source file
<i>Documentation/admin-guide/LSM/Smack.rst</i>.
<i>/sys/hypervisor</i>
[To be documented]
<i>/sys/kernel</i>
This subdirectory contains various files and subdirectories
that provide information about the running kernel.
<i>/sys/kernel/cgroup/</i>
For information about the files in this directory, see
<a href="https://man7.org/linux/man-pages/man7/cgroups.7.html">cgroups(7)</a>.
<i>/sys/kernel/debug/tracing</i>
Mount point for the <i>tracefs</i> filesystem used by the kernel's
<i>ftrace</i> facility. (For information on <i>ftrace</i>, see the
kernel source file <i>Documentation/trace/ftrace.txt</i>.)
<i>/sys/kernel/mm</i>
This subdirectory contains various files and subdirectories
that provide information about the kernel's memory
management subsystem.
<i>/sys/kernel/mm/hugepages</i>
This subdirectory contains one subdirectory for each of the
huge page sizes that the system supports. The subdirectory
name indicates the huge page size (e.g., <i>hugepages-2048kB</i>).
Within each of these subdirectories is a set of files that
can be used to view and (in some cases) change settings
associated with that huge page size. For further
information, see the kernel source file
<i>Documentation/admin-guide/mm/hugetlbpage.rst</i>.
<i>/sys/module</i>
This subdirectory contains one subdirectory for each module
that is loaded into the kernel. The name of each directory
is the name of the module. In each of the subdirectories,
there may be following files:
<i>coresize</i>
[to be documented]
<i>initsize</i>
[to be documented]
<i>initstate</i>
[to be documented]
<i>refcnt</i> [to be documented]
<i>srcversion</i>
[to be documented]
<i>taint</i> [to be documented]
<i>uevent</i> [to be documented]
<i>version</i>
[to be documented]
In each of the subdirectories, there may be following
subdirectories:
<i>drivers</i>
[To be documented]
<i>holders</i>
[To be documented]
<i>notes</i> [To be documented]
<i>parameters</i>
This directory contains one file for each module
parameter, with each file containing the value of
the corresponding parameter. Some of these files
are writable, allowing the
<i>sections</i>
This subdirectories contains files with information
about module sections. This information is mainly
used for debugging.
<i>[To be documented]</i>
<i>/sys/power</i>
[To be documented]
</pre>
<h2><a id="STANDARDS" href="https://man7.org/linux/man-pages/man5/sysfs.5.html#STANDARDS"></a>STANDARDS <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#top_of_page"><span class="top-link">top</span></a></h2><pre> Linux.
</pre>
<h2><a id="HISTORY" href="https://man7.org/linux/man-pages/man5/sysfs.5.html#HISTORY"></a>HISTORY <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#top_of_page"><span class="top-link">top</span></a></h2><pre> Linux 2.6.0.
</pre>
<h2><a id="NOTES" href="https://man7.org/linux/man-pages/man5/sysfs.5.html#NOTES"></a>NOTES <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#top_of_page"><span class="top-link">top</span></a></h2><pre> This manual page is incomplete, possibly inaccurate, and is the
kind of thing that needs to be updated very often.
</pre>
<h2><a id="SEE_ALSO" href="https://man7.org/linux/man-pages/man5/sysfs.5.html#SEE_ALSO"></a>SEE ALSO <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#top_of_page"><span class="top-link">top</span></a></h2><pre> <a href="https://man7.org/linux/man-pages/man5/proc.5.html">proc(5)</a>, <a href="https://man7.org/linux/man-pages/man7/udev.7.html">udev(7)</a>
P. Mochel. (2005). <i>The sysfs filesystem</i>. Proceedings of the 2005
Ottawa Linux Symposium.
The kernel source file <i>Documentation/filesystems/sysfs.txt</i> and
various other files in <i>Documentation/ABI</i> and
<i>Documentation/*/sysfs.txt</i>
</pre>
<h2><a id="COLOPHON" href="https://man7.org/linux/man-pages/man5/sysfs.5.html#COLOPHON"></a>COLOPHON <a href="https://man7.org/linux/man-pages/man5/sysfs.5.html#top_of_page"><span class="top-link">top</span></a></h2><pre> This page is part of the <i>man-pages</i> (Linux kernel and C library
user-space interface documentation) project. Information about
the project can be found at
⟨<a href="https://www.kernel.org/doc/man-pages/">https://www.kernel.org/doc/man-pages/</a>⟩. If you have a bug report
for this manual page, see
⟨<a href="https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING">https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING</a>⟩.
This page was obtained from the tarball man-pages-6.10.tar.gz
fetched from
⟨<a href="https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/">https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/</a>⟩ on
2025-02-02. If you discover any rendering problems in this HTML
version of the page, or you believe there is a better or more up-
to-date source for the page, or you have corrections or
improvements to the information in this COLOPHON (which is <i>not</i>
part of the original manual page), send a mail to
man-pages@man7.org
<span class="footline">Linux man-pages 6.10 2024-06-15 <i>sysfs</i>(5)</span>
</pre>
<hr class="end-man-text">
<p>Pages that refer to this page:
<a href="https://man7.org/linux/man-pages/man2/madvise.2.html">madvise(2)</a>,
<a href="https://man7.org/linux/man-pages/man2/sysfs.2.html">sysfs(2)</a>,
<a href="https://man7.org/linux/man-pages/man5/filesystems.5.html">filesystems(5)</a>,
<a href="https://man7.org/linux/man-pages/man5/proc.5.html">proc(5)</a>,
<a href="https://man7.org/linux/man-pages/man7/network_namespaces.7.html">network_namespaces(7)</a>
</p>
<hr>
<hr class="start-footer">
<div class="footer">
<table class="colophon-table">
<tbody><tr>
<td class="pub-info">
<p>
HTML rendering created 2025-02-02
by <a href="https://man7.org/mtk/index.html">Michael Kerrisk</a>,
author of
<a href="https://man7.org/tlpi/"><em>The Linux Programming Interface</em></a>.
</p>
<p>
For details of in-depth
<strong>Linux/UNIX system programming training courses</strong>
that I teach, look <a href="https://man7.org/training/">here</a>.
</p>
<p>
Hosting by <a href="https://www.jambit.com/index_en.html">jambit GmbH</a>.
</p>
</td>
<td class="colophon-divider">
</td>
<td class="tlpi-cover">
<a href="https://man7.org/tlpi/"><img src="./sysfs_files/TLPI-front-cover-vsmall.png" alt="Cover of TLPI"></a>
</td>
</tr>
</tbody></table>
</div>
<hr class="end-footer">
<!--BEGIN-SITETRACKING-->
<!-- SITETRACKING.man7.org_linux_man-pages -->
<!-- Default Statcounter code for man7.org/linux/man-pages
http://www.man7.org/linux/man-pages -->
<script type="text/javascript" async="" src="https://ssl.google-analytics.com/ga.js"></script><script type="text/javascript">
var sc_project=7422636;
var sc_invisible=1;
var sc_security="9b6714ff";
</script>
<script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async=""></script>
<noscript><div class="statcounter"><a title="Web Analytics
Made Easy - StatCounter" href="https://statcounter.com/"
target="_blank"><img class="statcounter"
src="https://c.statcounter.com/7422636/0/9b6714ff/1/"
alt="Web Analytics Made Easy -
StatCounter"></a></div></noscript>
<!-- End of Statcounter Code -->
<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9830363-8']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- End of Google Analytics Code -->
<!--END-SITETRACKING-->
</body></html>